import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/info',
    method: 'get',
    params: { token }
  })
}

export function getList(params) {
  return request({
    url: '/admin/list',
    method: 'get',
    params
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

export function getIdInfo(id, params) {
  return request({
    url: '/admin/get_info/' + id,
    method: 'get',
    params
  })
}

export function store(params) {
  return request({
    url: '/admin/store',
    method: 'post',
    params
  })
}

export function del(id, params) {
  return request({
    url: '/admin/delete/' + id,
    method: 'post',
    params
  })
}

export function changePwd(params) {
  return request({
    url: '/admin/change_pwd',
    method: 'post',
    params
  })
}

export function profile() {
  return request({
    url: '/admin/profile',
    method: 'get'
  })
}

export function saveProfile(params) {
  return request({
    url: '/admin/save_profile',
    method: 'post',
    params
  })
}